package com.yy.ui.controls
{
	import flash.events.Event;
	import flash.events.MouseEvent;

	public class TabButton extends Button
	{
		private var _select:Boolean = false;
		private var _onSelect:Function;
		public function TabButton(_arg1:Object=null)
		{
			super(_arg1);
			this.addEventListener(MouseEvent.CLICK, clickFunc);
		}
		
		private function clickFunc(e:Event):void {
			if(this.onSelect!=null)
			{
				this.onSelect(e);
			}
		}
		
		override protected function mouseOver():void{
			if (enable && !_select){
				this.skinGotoAndStop(2);
			};
		}
		override protected function mouseOut():void{
			if (enable && !_select){
				this.skinGotoAndStop(1);
			};
		}
		override protected function mouseDown():void{
//			if (enable){
//				_select = !_select;
//				select = _select;
//			};
		}
		
		/**
		 *设置选中状态 
		 * @param value
		 * 
		 */
		public function set select(value:Boolean):void
		{
			_select = value;
			if(_select) {
				this.skinGotoAndStop(3);
			}else {
				this.skinGotoAndStop(1);
			}
		}

		public function get onSelect():Function
		{
			return _onSelect;
		}
	}
}